var http = require("http");
var httpProxy = require("http-proxy");

var proxy = httpProxy.createProxyServer({});



var proxy_server = http.createServer(function(req, res) {
  proxy.web(req, res, { target: "http://127.0.0.1:8888" }, function(err,req,res,target) {
    if (err) {
      console.log(err);
    }

    // console.log("req===",req)
    // console.log("res===",res)
    console.log("target===",target)
  });
});
proxy.on("error", function(err, res) {
    if (err) {
      console.log(err);
    }
  });
proxy_server.listen(9999, function(req,res,target) {
    // console.log("req===",req)
    // console.log("res===",res)
    console.log("target===",target)
  console.log("反向代理监听开始！");
});
